package kayao.client.network.message;

import kayao.common.KayaoValues;
import kayao.common.NetworkUtils;

public class TeamCommunicationReply extends Message {

	protected byte[] mMessage=null;
	protected TeamCommunicationReply(String targetAddress, int retries,
			int timeoutLength, int priority, byte[] m) {
		super(targetAddress, retries, timeoutLength, priority);
		mMessage=m;
		createPacketData();
	}

	@Override
	public void createPacketData() {
		//[ MAGIC NUMBER (int32) | TeamMate-Message-Reply (b) | MessageCounter (int32) ]
		mSendData=new byte[9];
		NetworkUtils.insertIntToByteArray(mSendData,0,KayaoValues.MAGIC_NUMBER);
		mSendData[4]=KayaoValues.TEAM_COMMUNICATION_REPLY;
		//get id message
		int counter=NetworkUtils.insertByteArrayToInt(mMessage,5);
		//put in the answer
		NetworkUtils.insertIntToByteArray(mSendData, 5, counter);

	}

	@Override
	public String type() {
		// TODO Auto-generated method stub
		return "Team Communication Reply";
	}
}
